import java.util.Scanner;

/**
 * @author: gao
 * @create-date: 2025/4/16 21:56
 */

public class Solution {
    public int lengthOfLongestSubstring(String s) {
        char[] ch = s.toCharArray();
        int[] hash = new int[128];
        int len = 0;
        for (int right = 0, left = 0; right < s.length(); right++) {
            hash[ch[right]]++;
            while (hash[ch[right]] > 1) {
                hash[ch[left++]]--;
            }
            len = Math.max(len, right - left + 1);
        }
        return len;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            String s = in.nextLine();
            Solution solution = new Solution();
            System.out.println(solution.lengthOfLongestSubstring(s));
        }
    }
}